
PROG = main
OBJS = main.o cj.o
HEADERS = token.h

CFLAGS = -I${HOME}/include

CC=gcc

.SUFFIXES:
.SUFFIXES: .re .c .o

CLEANFILES = ${PROG} *.o  *.re.c __tmp.*

all: ${PROG}

.c.o:
	${CC} -c ${CFLAGS} -o $@ $<

.re.o:
	re2c -s -o __tmp.$<__tmp.c $<
	${CC} -c ${CFLAGS} -o $@ __tmp.$<__tmp.c
	rm -rf __tmp.$<__tmp.c

${OBJS}: ${HEADERS}


${PROG}: ${OBJS}
	${CC} ${CFLAGS} ${LDFLAGS} -o ${PROG} ${OBJS}

clean:
	rm -rf ${CLEANFILES}

